#include "ka200.h"

static int spi_check_param(spi_t *spi)
{
}

int spi_init(spi_t *spi)
{

    ssi = spi->port;

    ssi_enable(ssi, DISABLE);
    ssi_enable(ssi, ENABLE);
}

int spi_exit(spi_t *spi)
{
    ssi_addr_t *ssi;

    ssi = spi->port;
    ssi_enable(ssi, DISABLE);
}

int spi_xfer(spi_t *spi, int txlen, int rxlen)
{
}



#ifdef TEST_SPI

int main()
{
    spi_t spi2 = {0};

    uint8_t txbuf[4] = {0};
    uint8_t rxbuf[16] = {0};

    spi2.port             = SPI2;
    spi2.is_master        = SPI_IS_MASTER;
    spi2.ctrl_frame_size  = SPI_CFS_08_BIT;
    spi2.frame_format     = SPI_FRF_STAND;
    spi2.chip_select      = SPI_CS_0;
    spi2.transfer_mode    = SPI_TMOD_EEPROM_READ; // !!
    spi2.txbuf            = txbuf;
    spi2.rxbuf            = rxbuf;

    spi_init(&spi2);

    txbuf[0] = 0x9F;
    spi_xfer(&spi2, 1, 16);
}

#endif
